import 'dart:math';

import 'package:flutter/material.dart';
import 'package:my_app_01/components/MShimmer.dart';

class MenuShimmer extends StatelessWidget {
  const MenuShimmer({super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(20),
      child: Column(
        children: [
          const Row(
            children: [
              MShimmer(
                width: 20,
                height: 20,
              ),
              SizedBox(
                width: 20,
              ),
              MShimmer(
                width: 200,
                height: 20,
              )
            ],
          ),
          Card(
              margin: const EdgeInsets.only(top: 15, bottom: 30),
              color: Colors.white,
              surfaceTintColor: Colors.white,
              elevation: 6,
              shadowColor: Colors.black38,
              clipBehavior: Clip.hardEdge,
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(8),
              ),
              child: Container(
                  padding: const EdgeInsets.all(15),
                  child: GridView.builder(
                    physics: const NeverScrollableScrollPhysics(),
                    shrinkWrap: true,
                    padding: const EdgeInsets.all(0.0),
                    gridDelegate:
                        const SliverGridDelegateWithFixedCrossAxisCount(
                            //横轴元素个数
                            crossAxisCount: 4,
                            //垂直单个子widget间距
                            mainAxisSpacing: 4,
                            //水平单个子widget间距
                            crossAxisSpacing: 4,
                            //item宽高比例
                            childAspectRatio: 1.0),
                    itemBuilder: (context, index) {
                      return Container(
                        margin: const EdgeInsets.all(5),
                        child: MShimmer(
                          width: 50,
                          height: 50,
                        ),
                      );
                    },
                    itemCount: 16,
                  )))
        ],
      ),
    );
  }
}
